export default function createElement(type, props, ...children) {

    const childrenElements = [].concat(...children).reduce((res, child) => {
        // 过滤布尔值和null
        if (child !== false && child !== true && child !== null) {
            if (child instanceof Object) {
                res.push(child)
            } else {
                res.push(createElement('text', {
                    textContent: child
                }))
            }
        }
        return res
    }, [])
    return {
        type,
        props: Object.assign({
            children: childrenElements,
            ...props
        }),
        children: childrenElements
    }
}
